package wql.aaa.util;

import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author wql
 * @version 1.0
 * @date 2023/3/1 14:57
 */

@Data
@Component
public class ConstantPropertiesUtil implements InitializingBean {



    //读取配置文件的内容
    @Value("${aliyun.oss.file.endpoint}")
    public String endpoint;
    @Value("${aliyun.oss.file.keyid}")
    public String keyId;
    @Value("${aliyun.oss.file.keysecret}")
    public String keySecret;
    @Value("${aliyun.oss.file.bucketname}")
    public String bucketname;

    //静态常量
    public static String END_POINT;
    public static String ACCESS_KEY_ID;
    public static String ACCESS_KEY_SECRET;
    public static String BUCKET_NAME;

    @Override
    public void afterPropertiesSet() throws Exception {
        END_POINT = endpoint;
        ACCESS_KEY_ID = keyId;
        ACCESS_KEY_SECRET = keySecret;
        BUCKET_NAME = bucketname;
    }


    public String getEndpoint() {
        return endpoint;
    }

    public void setEndpoint(String endpoint) {
        this.endpoint = endpoint;
    }

    public String getKeyId() {
        return keyId;
    }

    public void setKeyId(String keyId) {
        this.keyId = keyId;
    }

    public String getKeySecret() {
        return keySecret;
    }

    public void setKeySecret(String keySecret) {
        this.keySecret = keySecret;
    }

    public String getBucketname() {
        return bucketname;
    }

    public void setBucketname(String bucketname) {
        this.bucketname = bucketname;
    }

    public static String getEndPoint() {
        return END_POINT;
    }

    public static void setEndPoint(String endPoint) {
        END_POINT = endPoint;
    }

    public static String getAccessKeyId() {
        return ACCESS_KEY_ID;
    }

    public static void setAccessKeyId(String accessKeyId) {
        ACCESS_KEY_ID = accessKeyId;
    }

    public static String getAccessKeySecret() {
        return ACCESS_KEY_SECRET;
    }

    public static void setAccessKeySecret(String accessKeySecret) {
        ACCESS_KEY_SECRET = accessKeySecret;
    }

    public static String getBucketName() {
        return BUCKET_NAME;
    }

    public static void setBucketName(String bucketName) {
        BUCKET_NAME = bucketName;
    }
}

